function getRootPath_web() {
            //获取当前网址，如： http://localhost:8083/uimcardprj/share/meun.jsp
            var curWwwPath = window.document.location.href;
            //获取主机地址之后的目录，如： uimcardprj/share/meun.jsp
            var pathName = window.document.location.pathname;
            var pos = curWwwPath.indexOf(pathName);
            //获取主机地址，如： http://localhost:8083
            var localhostPaht = curWwwPath.substring(0, pos);
            //获取带"/"的项目名，如：/uimcardprj
            var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
            return (localhostPaht + projectName);
        }

(function ($) {
    $.getUrlParam = function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
})(jQuery);

/**
 * 修改密码
 */
$(function () {

    var counter = 0;
    if (window.history && window.history.pushState) {
        $(window).on('popstate', function () {
            window.history.pushState('forward', null, '#');
            window.history.forward(1);

        });
    }
    window.history.pushState('forward', null, '#'); //在IE中必须得有这两行
    window.history.forward(1);


    $("#btn_alertpassword").click(function () {
        window.location.href= getRootPath_web()+"/user/alertPasswordPage";
    })

    $("#btn_exit").click(function () {
        bootbox.confirm("是否退出?", function(result){
            if (result){
                $.post(getRootPath_web()+"/user/logout",{},function (data) {
                    if (data){
                        bootbox.alert({
                            message: "退出成功",
                            locale: 'zh_CN',
                            callback: function(){
                                window.location.href= getRootPath_web()+"/jsp/login.jsp";
                            }
                        });
                    } else {
                        bootbox.alert({
                            message: "退出失败",
                            locale: 'zh_CN'
                        });
                    }
                },'json')
            }
        });
    })
})

